package priv.pattern.responsibility.pojo;

import lombok.Data;

import java.util.Objects;


public enum ResponsibilityEnum {
    BUY_OFFICE_SUPPLIES(0, "购买办公用品"),
    ASK_FROM_LEAVE(1, "请假"),
    BUY_OFFICE_APPLIANCES(2, "购买办公电器"),
    APPLY_FOR_A_JOB(3, "申请招人"),
    APPLICATION_FOR_CHANGE_OF_OFFICE(4, "申请更换办公室"),
    APPLICATION_FOR_RESIGNATION(5, "申请离职");


    private final Integer typeCode;
    private final String typeDesc;

    public static ResponsibilityEnum findTypeByCode(Integer code) {
        for (ResponsibilityEnum eunm : ResponsibilityEnum.values()) {
            if (Objects.equals(eunm.getCode(), code)) {
                return eunm;
            }
        }
        System.out.println("公司暂时还没有你提交的申请。");
        return null;
    }

    public Integer getCode() {
        return typeCode;
    }

    ResponsibilityEnum(int typeCode, String typeDesc) {
        this.typeCode = typeCode;
        this.typeDesc = typeDesc;
    }
}
